{include admin.inc.header}

{include admin.inc.top}

<div class="container-fluid content-body">
	<div class="main">
		{include admin.inc.menu}

		<section class="right-section" id="right-section">
			<!-- start of inner-frame -->
			<div class="inner-iframe">
				<ul class="breadcrumb">
					<li>
						<i class="glyphicon glyphicon-home"></i>
						<span>当前位置：</span>
						<a href="#">{$breadcrumb[0]}</a>
						<i class="glyphicon glyphicon-chevron-right"></i>
						<a href="#">{$breadcrumb[1]}</a>
					</li>
				</ul>

				<!-- Nav tabs -->
				<ul class="nav nav-tabs">
					<li class="active"><a href="{$add_url}"><i class="glyphicon glyphicon-plus"></i> 添加报价</a></li>
					<li><a href="{$index_url}"><i class="glyphicon glyphicon-th-list"></i> 报价列表</a></li>
					<li><a href="javascript:void(0);"><i class="glyphicon glyphicon-edit"></i> 编辑报价</a></li>
				</ul>

				<div class="inner-container">

					<form role="form" class="content-add-form form-horizontal" id="content-add-form" autocomplete="off">

						<div class="form-group">
							<label class="col-sm-2 control-label"><span class="asterisk">*</span> 用户名</label>
							<div class="col-sm-10">
								<input type="text" name="data[username]"
									   class="form-control" dtype="uname" maxlength="20" placeholder="用户名" message="用户名只能由字母和数字组成" required />
								<p class="help-block">20个字符之内</p>
							</div>
						</div>

						<div class="form-group">
							<label class="col-sm-2 control-label"><span class="asterisk">*</span>  登录密码</label>
							<div class="col-sm-10">
								<input type="password" name="data[password]" id="password" handler="__checkPass(value, ele)" class="form-control" maxlength="20" min-length="6" placeholder="登录密码" required />
								<p class="help-block">6-20位数字和字母组合</p>
							</div>
						</div>
						<script>
							function __checkPass(value, ele) {
								if ( /^\d+$/.test(value) ) {
									$(ele).next().addClass("text-error").html('密码不能为纯数字');
									ele.focus();
									return false;
								}
								if ( /^[a-z|a-z]+$/.test(value) ) {
									$(ele).next().addClass("text-error").html('密码不能为纯字母');
									ele.focus();
									return false;
								}
								return true;
							}
						</script>

						<div class="form-group">
							<label class="col-sm-2 control-label"><span class="asterisk">*</span> 确认密码</label>
							<div class="col-sm-10">
								<input type="password" dtype="repass" class="form-control" placeholder="确认密码" maxlength="20" for-password="password" required />
								<p class="help-block"></p>
							</div>
						</div>

						<div class="form-group">
							<label class="col-sm-2 control-label"><span class="asterisk">*</span> 管理员角色</label>
							<div class="col-sm-10">
								<select class="form-control" name="data[role_id]" required>
									<option value="0">超级管理员</option>
									{loop $roles $role}
									<option value="{$role[id]}">{$role[name]}</option>
									{/loop}
								</select>
								<p class="help-block"></p>
							</div>
						</div>

						<div class="form-group">
							<label class="col-sm-2 control-label"><span class="asterisk">*</span> 手机号码</label>
							<div class="col-sm-10">
								<input type="text" dtype="mobile" name="data[mobile]" class="form-control" placeholder="手机号码" required/>
								<p class="help-block"></p>
							</div>
						</div>

						<div class="form-group">
							<label class="col-sm-2 control-label"><span class="asterisk">*</span> 姓名</label>
							<div class="col-sm-10">
								<input type="text" name="data[name]" class="form-control" maxlength="15" placeholder="姓名" required/>
								<p class="help-block"></p>
							</div>
						</div>

						<div class="form-group">
							<label class="col-sm-2 control-label">工号</label>
							<div class="col-sm-10">
								<input type="text" name="data[jobno]" dtype="number" class="form-control" maxlength="5" placeholder="工号"/>
								<p class="help-block">不超过5位数字</p>
							</div>
						</div>

						<div class="form-group">
							<label class="col-sm-2 control-label">邮箱</label>
							<div class="col-sm-10">
								<input type="text" name="data[email]" maxlength="30" class="form-control" placeholder="邮箱" />
								<p class="help-block"></p>
							</div>
						</div>

						<div class="form-group">
							<label class="col-sm-2 control-label"><span class="asterisk">*</span> 账户状态</label>
							<div class="col-sm-10">
								<div>
									<input type="checkbox" class="bswitch bswitch-add" checked data-on-text="启用" data-off-text="禁用">
									<input type="hidden" name="data[status]" value="1">
								</div>
								<p class="help-block">被禁用的管理员账号将无法正常登陆系统</p>
							</div>
						</div>

						<div class="form-group">
							<label class="col-sm-2 control-label">简介</label>
							<div class="col-sm-10">
								<textarea name="data[summary]" class="form-control" maxlength="100" placeholder="这里输入管理员简介"></textarea>
								<p class="help-block"></p>
							</div>
						</div>

						<div class="form-group">
							<div class="col-sm-offset-2 col-sm-10">
								<div class="btn-group btn-group-or">
									<a href="{$insert_url}" class="btn btn-primary" id="submit_btn"
									   proxy='{"method":"post", "location":"{$index_url}"}'>提交保存</a>
									<span class="or">OR</span>
									<button type="reset" class="btn btn-default">重置表单</button>
								</div>
							</div>
						</div>

					</form>

				</div>
			</div><!-- end of inner -->

		</section>

	</div>
</div>

{include admin.inc.footer}

<script>
	seajs.use("manager", function(exports) {
		exports.init({
			check_url : '/admin/manager/exists'
		});
	});
</script>
</body>
</html>
